<?php
/**
 * Created by PhpStorm.
 * User: zhaoq02
 * Date: 2015-04-29
 * Time: 19:27
 */

/* @var $this \yii\web\View */

use yii\helpers\Html;
use common\utils\DomainUtil;

?>
<!-- 左侧菜单 -->

<script type="text/javascript">
    $(function(){
        activeItem("企业认证");
    });

</script>
<!-- 左侧菜单.end -->



<script type="text/javascript">
    /**
     * 静态页面引用-公共侧边栏
     */

    function trim (str) {
        if (str) {
            return str.replace(/^\s+|\s$/g, "");
        }
        return "";
    }

    // 初始化高亮侧边栏
    function activeItem(str) {
        var sidebar = document.getElementById("sidebar");
        var a = sidebar.getElementsByTagName("a");

        for (var i = 0, l = a.length; i < l; i += 1) {
            if (trim(a[i].innerText) === str) {
                a[i].className = "active";
                return false;
            }
        }
    }

    var templData = {
        // domain: "mycaigou"   // 正式环境
        // domain:"b2bmir"  // 镜像环境
        // domain:"b2btst"  // 测试环境
        // domain:"b2bdev" // 开发环境
    };

    var tmpl = heredoc(function(){/*
     <div id="sidebar" class="sidebar">
     <ul class="sidebar_list">
     <li class="account">
     <h3><span>帐号管理</span></h3>
     <ul>
     <li><a href="<?=DomainUtil::getDomainLink("MemberCenter_2", "/card/view.do") ?>">电子名片</a></li>
     <li><a href="<?=DomainUtil::getDomainLink("MemberCenter_2", "/account.do")?>">帐号安全</a></li>
     </ul>
     </li>
     <li class="auth">
     <h3><span>我的认证</span></h3>
     <ul>
     <li><a href="/companycert/index">企业认证</a></li>
     </ul>
     </li>
     </ul>
     </div>
     */});
    document.write(templ(tmpl));

    function heredoc(fn) {
        return fn.toString().split('\n').slice(1,-1).join('\n') + '\n'
    }

    function templ(templ, data) {
        data = data || templData;
        return templ.replace(/\{\{(\w+)\}\}/g, function (m, m1) {
            return data[m1] || "";
        });
    }
</script>
